﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using COFE.Core;
using COFE.Core.Lister;

namespace COFE.Core
{   
    /// <summary>
    /// Represent a file system file or folder.
    /// </summary>
    public interface IFileSystemInfo : INotifyFileSystemChanged
    {
        IInternalFileSystemInfoExA InternalProperties { get; }

        /// <summary>
        /// Cast this entry as dynamic, enable obtaining properties.
        /// </summary>
        dynamic DynamicProperties { get; }

        /// <summary>
        /// Gets the display text for the entries, not always same as Name.
        /// </summary>
        string Label { get; }

        /// <summary>
        /// Gets the path accessable in IO, expand and return a temp path if this virtual entries (!IsFileSystem).
        /// May return null if manager.TempPath is not set.
        /// </summary>
        string FullName { get; }

        /// <summary>
        /// For virtual item  (!IsFileSystem), the temporary path in file system (IO), unlike FullName, calling TempPath will not expanded
        /// </summary>
        string TempPath { get; }

        /// <summary>
        /// Gets the name of the entries.
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Gets the full parsable path with volume key, parsable by user manager. (e.g. {Lister}\Temp}
        /// </summary>
        string ParseName { get; }

        /// <summary>
        /// DirectoryLister created the current entries.
        /// </summary>
        string ListerKey { get; }
        
        /// <summary>
        /// Gets whether the entries exists.
        /// </summary>
        bool Exists { get; }

        /// <summary>
        /// Return the parent of current entries, null if current entries is root.
        /// </summary>
        IDirectoryInfo Parent { get; }

        /// <summary>
        /// Return attributes of current entries.
        /// </summary>
        FileAttributes Attributes { get; }

        /// <summary>
        /// Return extra attributes of current entries.
        /// </summary>
        COFEAttributes COFEAttributes { get; }

        /// <summary>
        /// Gets the time when the current entries was last written to.
        /// </summary>
        DateTime LastWriteTime { get; }

        /// <summary>
        /// Gets the time when the current entries was last accessed.
        /// </summary>
        DateTime LastAccessTime { get; }

        /// <summary>
        /// Gets the time when the creation time of the current entries.
        /// </summary>
        DateTime CreationTime { get; }

        /// <summary>
        /// Gets whether current entries is directory.
        /// </summary>
        bool IsFolder { get; }

        ///// <summary>
        ///// Gets whether current entries is virtual.
        ///// </summary>
        //bool IsVirtual { get; }

        /// <summary>
        /// Get whether current entries belong to a FileSystem.
        /// If not, changed file will trigger IInternalFileInfoExA.UpdateSource(), which will upload back the file to parent.
        /// </summary>
        bool IsFileSystem { get; }

        /// <summary>
        /// Remove the current entries.
        /// </summary>
        void Delete();

        /// <summary>
        /// Refresh properties of the current entries.
        /// </summary>
        void Refresh();

        /// <summary>
        /// Return whether an entries equals to another.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        bool Equals(object obj);

        /// <summary>
        /// Return hash code of the current entries, default implementation is based on ParseName.
        /// </summary>
        /// <returns></returns>
        int GetHashCode();

        /// <summary>
        /// Gets a Guid that represent the current entries, based on ParseName, so hash changes if rename.
        /// </summary>
        Guid GetId();

       
    }
}
